<?php
/**
 * Ecart
 *
 * This file is part of Ecart.
 *
 * Ecart is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Ecart is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Ecart.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @category    Ecart
 * @package     Ecart_Account
 * @copyright   Copyright 2008-2009 E-Cart LLC
 * @license     GNU Public License V3.0
 */


class Ecart_PaymentCheckMoney_Upgrade_0_1_0 extends Ecart_Core_Model_Migration_Abstract
{
    protected $_version = '0.1.0';
    protected $_info = 'install';

    public function up()
    {
        $installer = Ecart::single('install/installer');

        Ecart::single('core/config_field')
            ->add('payment', 'Payment Methods', null, null, array('translation_module' => 'Ecart_Admin'))
            ->add('payment/CheckMoney_Standard', 'Payment Methods/Check & Money Order', null, null, array('translation_module' => 'Ecart_PaymentCheckMoney'))
            ->add('payment/CheckMoney_Standard/enabled', 'Payment Methods/Check & Money Order/Enabled', '0', 'bool', array('translation_module' => 'Ecart_Core'))
            ->add('payment/CheckMoney_Standard/title', 'Title', 'Check & Money Order', 'string', 'Title')
            ->add('payment/CheckMoney_Standard/geozone', 'Allowed Payment Zone', '1', 'select', 'Payment method will be available only for selected zone', array('model' => 'Geozone', 'translation_module' => 'Ecart_Admin'))
            ->add('payment/CheckMoney_Standard/sortOrder', 'Sort Order', '1', 'string', array('translation_module' => 'Ecart_Core'))
            ->add('payment/CheckMoney_Standard/orderStatusId', 'Order Status on payment complete', '1', 'select', 'Set the status of orders made with this payment module to this value', array('config_options' => '{"1":"pending"}', 'translation_module' => 'Ecart_Admin'))
            ->add('payment/CheckMoney_Standard/minOrderTotal', 'Minimum order total amount', '', 'string', array('translation_module' => 'Ecart_Admin'))
            ->add('payment/CheckMoney_Standard/maxOrderTotal', 'Maximum order total amount', '', 'string', array('translation_module' => 'Ecart_Admin'))
            ->add('payment/CheckMoney_Standard/payTo', 'Make check payable to', 'The Ecart Store Company', 'string', 'Who should payments be made payable to?')
            ->add('payment/CheckMoney_Standard/sendCheckTo', 'Send your check to', 'Store Name <br />Address <br />Country <br />Phone', 'text', ' This is the Store Name, Address and Phone used on printable documents and displayed online')
            ->add('payment/CheckMoney_Standard/shippings', 'Disallowed Shippings', '0', 'multiple', 'Selected shipping methods will be not available with this payment method', array('model' => 'Shipping', 'translation_module' => 'Ecart_Admin'));
    }

    public function down()
    {
        $installer = Ecart::single('install/installer');

        Ecart::single('core/config_value')->remove('payment/CheckMoney_Standard');
        Ecart::single('core/config_field')->remove('payment/CheckMoney_Standard');
    }
}